package com.zzp.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzp.mapper.TbBrandMapper;
import com.zzp.mapper.TbCategoryMapper;
import com.zzp.mapper.TbGoodMapper;
import com.zzp.pojo.TbBrand;
import com.zzp.pojo.TbCategory;
import com.zzp.pojo.TbGood;
import com.zzp.service.GoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class GoodServiceImpl implements GoodService {
    @Autowired
    private TbGoodMapper goodMapper;
    @Autowired
    private TbCategoryMapper tbCategoryMapper;
    @Autowired
    private TbBrandMapper tbBrandMapper;

    @Override
    public Page<TbGood> selectGoodByBrandIdAndCategoryId(String brandId, String categoryId, Integer pageNum, Integer pageSize) {
        Page<TbGood> page = new Page<>(pageNum, pageSize);
        goodMapper.selectGood(page,categoryId,brandId);
        return page;
    }

    @Override
    public TbGood selectGoodId(String goodId) {
        return goodMapper.selectById(goodId);
    }

}
